﻿<navigation:Page
    x:Class="LogViewApp.Home" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:LogViewApp.Controls"
    xmlns:classes="clr-namespace:LogViewApp.Models"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"  
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"  
    Style="{StaticResource PageStyle}" DataContext="{Binding Source={StaticResource Locator}, Path=homeViewModel}">

    <UserControl.Resources>
        <classes:ByteConverter x:Key="ByteConverter"/>
        <classes:PercentConverter x:Key="PercentConverter"/>

        <Storyboard x:Name="sbProgress">
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="TotalProgress" Storyboard.TargetProperty="(RangeBase.Value)">
                <SplineDoubleKeyFrame x:Name="sbProgressFrame" KeyTime="00:00:00.5000000" Value="10"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

    </UserControl.Resources>

    <vsm:VisualStateManager.VisualStateGroups>
        <vsm:VisualStateGroup x:Name="UploadingStates">
            <vsm:VisualStateGroup.Transitions>
                <vsm:VisualTransition GeneratedDuration="00:00:00.2000000"/>
            </vsm:VisualStateGroup.Transitions>
            <vsm:VisualState x:Name="Empty">
                <Storyboard>
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="UploadButton" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ClearButton" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FilesCountPanel" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FilesSizePanel" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ProgressPanel" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </vsm:VisualState>
            <vsm:VisualState x:Name="Selected">
                <Storyboard>
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="UploadButton" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ClearButton" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FilesCountPanel" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FilesSizePanel" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ProgressPanel" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </vsm:VisualState>
            <vsm:VisualState x:Name="Finished">
                <Storyboard>
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="UploadButton" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </vsm:VisualState>
        </vsm:VisualStateGroup>
    </vsm:VisualStateManager.VisualStateGroups>

    <Grid x:Name="LayoutRoot">
    <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}" >

      <StackPanel x:Name="ContentStackPanel" Style="{StaticResource ContentStackPanelStyle}">

        <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}" 
                           Text="{Binding Path=ApplicationStrings.HomePageTitle, Source={StaticResource ResourceWrapper}}"/>
        <TextBlock x:Name="ContentText" Style="{StaticResource ContentTextStyle}" 
                           Text="Home page content"/>
          <StackPanel Orientation="Horizontal">
                <Button Margin="5" Width="90" Content="Add File..." Command="{Binding Path=BrowseFileCmd}" />
                    <Button Margin="5" Width="90" x:Name="UploadButton" Content="Upload" Command="{Binding UploadCmd}"></Button>
                    <Button Margin="5" Width="90" x:Name="ClearButton" Content="Clear Pending" Command="{Binding ClearCmd}"></Button>
                    <Button Margin="5" Width="90" Content="View" Command="{Binding Path=ViewCmd}" CommandParameter="{Binding ElementName=listBox1, Path=SelectedItem}"/>
                    <Button Margin="5" Width="90" Content="Compare" Command="{Binding Path=CompareCmd}" CommandParameter="{Binding ElementName=listBox1, Path=SelectedItem}"/>
                </StackPanel>
                <Grid AllowDrop="True" Drop="Border_Drop" Margin="5" Height="397" DragEnter="Grid_DragEnter" DragLeave="Grid_DragLeave">
                    <TextBlock Margin="1" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{Binding DropBoxTextColor}" FontSize="26" FontWeight="ExtraBold" FontStyle="Italic"
                               Text="{Binding DropBoxText}">
                        
                    </TextBlock>
                    <!--<ListBox Margin="10" Name="listBox1"  Background="Transparent" ItemsSource="{Binding Path=fileList}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>-->
                    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible" Background="Transparent">
                        <ItemsControl x:Name="FileList" ItemsSource="{Binding Path=files}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <local:FileRowControl></local:FileRowControl>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </ScrollViewer>
                </Grid>
            </StackPanel>
        

    </ScrollViewer>
  </Grid>

</navigation:Page>